package com.example.springboot.utils;

import java.util.UUID;

/**
 * @author danqihao
 */
public class UidGenerator {
    public static String generateUUID() {
        // 生成随机UUID
        UUID uuid = UUID.randomUUID();
        // 转换为字符串，格式为8-4-4-4-12的36个字符
        return uuid.toString();
    }

    public static void main(String[] args) {
        String uid = generateUUID();
        System.out.println("生成的UUID: " + uid);
        // 示例输出: 550e8400-e29b-41d4-a716-446655440000
    }
}